# -*- coding: utf-8 -*-
from matplotlib import pyplot as plt

def plot_one(conf,x,yavr,yerr,name):
    plt.errorbar(x, yavr, yerr=yerr, fmt=conf['fmt'],label=name)

def plot(parg):
    conf = parg.load_conf(default_conf={'fmt':'-'})
    plt.xlabel(parg.data['xlabel'])
    plt.ylabel(parg.data['ylabel'])
    for data in parg.data['series']:
        plot_one(conf,data['x'],data['y'],data['yerr'],data['name'])
    plt.legend()
    parg.end()
